//
//  NHTViewController.m
//  NHT_Push
//
//  Created by nhtemail@163.com on 10/27/2023.
//  Copyright (c) 2023 nhtemail@163.com. All rights reserved.
//

#import "NHTViewController.h"
#import <NHTPushService.h>

@interface NHTViewController ()

@end

@implementation NHTViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = UIColor.redColor;
    
    UIButton *start = [[UIButton alloc] initWithFrame:CGRectMake(10, 100, 100, 100)];
    [self.view addSubview:start];
    start.backgroundColor = UIColor.yellowColor;
    [start addTarget:self action:@selector(socket) forControlEvents:UIControlEventTouchUpInside];
    
    UIButton *close = [[UIButton alloc] initWithFrame:CGRectMake(10, 300, 100, 100)];
    [self.view addSubview:close];
    close.backgroundColor = UIColor.yellowColor;
    [close addTarget:self action:@selector(close) forControlEvents:UIControlEventTouchUpInside];
    

}
-(void)socket{
    [NHTPushService shareNHTPush].userSocketAdress = @"http://122.115.233.174:8438/jkws/";
    [[NHTPushService shareNHTPush] NHTPushSocketOpen:false resultBlock:^(NSInteger state) {
        NSLog(@"socket连接状态改变:%ld",state);
    }];
}
-(void)close{
    [[NHTPushService shareNHTPush] NHTPushSocketClose];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
